'''
int x, y ,_x1, _y1 ,sum, Min,Max,[]m,*pr;
result=Max+_x1*10+_y1/2 + x2-pr + m[0] - m[1],&pr;
'''
import re

line1 = input()
line2 = input()

line1 = re.split('[,;\[\]\s]+', line1)
line1.remove('')
line1.pop(0)
line2 = re.split('[\=\+\-\*\/\;\[\]\s]+', line2)
line2.remove('')
ans = []
for i in line2:
    if not str.isdigit(i) and i not in line1:
        ans.append(i)

if 'pr' in ans:
    ans.remove('pr')
for i in ans:
    print(i, end=' ')

